    <div id="breadcrumbs"><?php echo $this->Html->link('Home', array('controller' => 'contents', 'action' => 'view', 'home')); ?> > Current Roster
    </div>
<?php
//display next month for assigning
$month = $this->Time->format('m', $timeset);
$monthyear = $this->Time->format('Y-m', $timeset);
?>

<div class="month">
    <?php
    echo "<table>";
    echo "<tr>";
    echo "<th>";
    if ($timeset != "-1 month") {
        echo $this->Html->link('<<', array('action' => 'index', 0)) . " ";
    }
    echo "</th>";

    echo "<th>";
    if ($timeset == "+1 month") {
        echo $this->Html->link('<', array('action' => 'index', 1));
    }
    echo "</th>";

    echo "<th>";
    echo "<h2><b>" . $this->Time->format('F', $timeset) . "</b></h2>";
    echo "</th>";

    echo "<th>";
    if ($timeset == "-1 month") {
        echo $this->Html->link('>', array('action' => 'index', 1));
    }
    echo "</th>";

    echo "<th>";
    if ($timeset != "+1 month") {
        echo $this->Html->link('>>', array('action' => 'index', 2));
    }
    echo "</th></style>";

//debug($this->Time->format('m', $timeset));
    echo "</tr>";
    echo "</table>";
    ?>
</div>

<div class="viewRoster">
    <table>
        <tr> <b><u>
                <th>Monday</th>
                <th>Tuesday</th>
                <th>Wednesday</th>
                <th>Thursday</th>
                <th>Friday</th>
        </b></u></tr> 

        <?php
        $startdate = $this->Time->format('l', $monthyear . '-1');

//creating calendar view
        if ($startdate == "Monday") {
            echo "<tr>";
        } else if ($startdate == "Tuesday") {
            echo "<tr><td>";
        } else if ($startdate == "Wednesay") {
            echo "<tr><td><td>";
        } else if ($startdate == "Thursday") {
            echo "<tr><td><td><td>";
        } else if ($startdate == "Friday") {
            echo "<tr><td><td><td><td>";
        }

        for ($n = 1; $n <= $this->Time->format('t', $month); $n++) {
            $day = $this->Time->format('l', $monthyear . "-" . $n);

            if (($day != "Saturday") && ($day != "Sunday")) {
                echo "<td><b>" . $n . "</b><br>";
                //the other codes should be here


                foreach ($times as $timings):
                    echo "<br>";
                    echo "<b>" . $this->Time->format('H:i', $timings['Time']['time_from']) . " - " . $this->Time->format('H:i', $timings['Time']['time_to']) . "</b> \n";
                    echo "<br>";

                    foreach ($rosters as $roster):
                        if ($this->Time->format('j', $roster['Roster']['ros_date']) == $n && $this->Time->format('Y-m', $roster['Roster']['ros_date']) == $monthyear) {
                            if ($timings['Time']['id'] == $roster['Roster']['time_id']) {
                                foreach ($users as $user):
                                    if ($user['User']['user_id'] == $roster['Roster']['ros_userid']) {
                                        echo $user['User']['staff_name'];
                                        echo "<br>";
                                    }

                                endforeach;
                            }
                        }

                    endforeach;

                endforeach;

                echo "</td>";
                if ($day == "Friday") {
                    echo "</tr>";
                }
            }
        }
        ?>
    </table>
    <?php
    echo $this->Html->link('Edit', array('action' => 'assign'), array('class' => 'clean-gray'));
    ?>
    <br><br>
</div>